With development of communications technologies, a large number of gateway devices exist on the mobile Internet and the Internet. As a network continues to change and user service requirements increase, a gateway on the network not only needs to complete traditional gateway functions such as protocol conversion, but also needs to support processing on some non-traditional gateway services, such as classification and filtering based on a uniform resource locator (Uniform Resource Locator, URL), reports, website Web optimization, cache memory Cache acceleration, and other services. Some of these services are completed by an external service server of the gateway. When processing on various non-traditional gateway services needs to be completed by the external service server, the gateway on the network needs to support a traffic distribution function and be capable of distributing traffic to the external service server.
Generally, a traffic distribution method adopted by the gateway is as follows: Received traffic is matched based on routing or policy-based routing, and if the matching succeeds, the traffic is then distributed to the external service server, and the service server completes service processing.
However, the foregoing traffic distribution method supports only port-based traffic distribution, and this method is inaccurate with false determination and missed determination and therefore cannot satisfy application-based traffic distribution. In addition, this traffic distribution method may cause a large amount of traffic that does not need to be processed to be distributed to the external service server. As a result, the external service server needs to forward and process the traffic that does not need to be processed, thereby resulting in a waste of overall system resources and increasing device investments of an operator.